"use strict";

const js = require('@eslint/js');
const tsParser = require('@typescript-eslint/parser');
const tsPlugin = require('@typescript-eslint/eslint-plugin');
const reactPlugin = require('eslint-plugin-react');
const { defineConfig } = require('eslint-define-config');

module.exports = defineConfig([
    {
        files: ['**/*.{ts,tsx}'],
        languageOptions: {
            parser: tsParser,
            parserOptions: {
                ecmaFeatures: {
                    jsx: true
                },
                project: './tsconfig.json'
            }
        },
        plugins: {
            '@typescript-eslint': tsPlugin,
            react: reactPlugin
        },
        rules: {
            ...js.configs.recommended.rules,
            ...tsPlugin.configs.recommended.rules,
            ...reactPlugin.configs.recommended.rules,
            'no-console': 'warn',
            'react/react-in-jsx-scope': 'off',
            "no-undef": "off"
        },
        "settings": {
            "import/resolver": {
                "alias": {
                    "map": [["@", "./src"]],
                    "extensions": [".ts", ".tsx", ".js", ".jsx"]
                }
            },
            "react": {
                "version": "detect"
            },
        }
    }
])